

(function () {
    function sendReq() {
        var msg = {};
        var sname = $('#sname').val();
        var sid = $('#sid').val();
        var sex = $('#sex option:selected').val();
        var major_id = $('#major option:selected').attr('major_id');
        var max_num = $('#max_num').val();
        var birthday = $('#birthday').val();
        msg.sname = sname;
        msg.sid = sid;
        msg.sex = sex;
        msg.major_id = major_id;
        msg.max_num = max_num;
        msg.birthday = birthday;
        console.log(msg);
        $.ajax({
            url: '/sc/admin/add_student',
            data: msg,
            dataType: "text",
            success: function (data) {
                if (data == "success") {
                    alert("添加成功!")
                }
                else {
                    alert('添加失败!')
                }
            }
        })
    }
    $('.submit').click(sendReq);
})()